package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.TourGroupMember;
import com.ruoyi.system.domain.TourWorker;
import com.ruoyi.system.mapper.TourGroupMemberMapper;
import com.ruoyi.system.mapper.TourWorkerMapper;
import com.ruoyi.system.service.ITourWorkerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TourWorkerService implements ITourWorkerService {
    @Autowired
    private TourWorkerMapper TourWorkerMapper;

    @Override
    public List<TourWorker> selectWorkerList() {
        return TourWorkerMapper.selectWorkerList();
    }

    @Override
    public void delectWorker(int id) {
        TourWorkerMapper.deleteWorker(id);
    }

    @Override
    public int createWorker(TourWorker worker) {

        try {
            TourWorkerMapper.createWorker(worker);
            return worker.getId();
        }catch (Exception e){
            e.printStackTrace();
            return 0;
        }
    }

    @Override
    public void updateWorker(TourWorker worker) {
        TourWorkerMapper.updateWorker(worker);
    }
}
